const express = require('express');
const server = express();

// body-parser
const bodyParser = require('body-parser');
server.use(bodyParser.urlencoded({ extended: false }));
server.use(bodyParser.json());

// cors
const cors = require('cors');
server.use(cors());

// mongodb connect
require('./database/connect')


// userRouter
const userRouter = require('./routers/userRouter');
server.use('/api/user', userRouter);


// dataRouter
const dataRouter = require('./routers/dataRouter');
server.use('/api/data', dataRouter);


// passport
const passport = require('passport');
server.use(passport.initialize());
require('./config/passport')(passport);

server.use('/', (req, res) => {
  res.send('test');
})

server.listen(3000, () => {
  console.log('http://localhost:3000');
})